$(function () {
    var url = 'http://level3.5ihy.com/index.php';
    function check(myphone,mynumber) {
        //检测 手机号
        var myphone_reg = /^(13[0-9]|15[7-9]|153|156|18[7-9])[0-9][8]$/;
        var myphone_reg_test = myphone_reg.test(myphone);
        if (myphone_reg_test)
        {
            return true;
        }
        alert("输入的信息有误");
        return false;
    }
    $("#qianggou").click(function () {
        var myphone = $("#myphone").val();
        var mynumber = $("#mynumber").val();
        var data = {'phone':myphone,'number':mynumber};
        var res = check(myphone,mynumber);
        if (res)
        {
            $.ajax({
                url:url,
                data:data,
                dataType:'jsonp',
                jsonp:'callback',
                jsonpCallback:"success_jsonpCallback",
                success:function (cc) {
                    if (cc.msg=='ok')
                    {
                        $.cookie('miao','ok');
                    }
                },
                error:function () {
                    $.cookie('miao',null);
                },
                timeout:300
            });
        }
    })
    //检测是否秒杀了
    var miao = $.cookie('miao');
    if (miao)
    {
        alert('你已经成功登记');
        // $("#qianggou").remove();
    }
})